#!/bin/bash

echo "🎨 启动前端服务..."

cd frontend

echo "📦 检查前端依赖..."
if [ ! -d "node_modules" ]; then
    echo "安装前端依赖..."
    npm install
fi

echo "▶️  启动前端开发服务器 (端口: 8081)..."
nohup npm run dev > ../frontend.log 2>&1 &
echo "✅ 前端服务已启动 (PID: $!)"
echo "   访问地址: http://localhost:8081"
echo "   日志文件: frontend.log"